}
}
-static gboolean
-gtk_application_impl_dbus_is_inhibited (GtkApplicationImpl *impl,
- GtkApplicationInhibitFlags flags)
-{
- GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) impl;
- GVariant *res;
- GError *error = NULL;
- gboolean inhibited;
- static gboolean warned = FALSE;
-
- if (dbus->sm_proxy == NULL)
- return FALSE;
-
- res = g_dbus_proxy_call_sync (dbus->sm_proxy,
- "IsInhibited",
- g_variant_new ("(u)", flags),
- G_DBUS_CALL_FLAGS_NONE,
- G_MAXINT,
- NULL,
- &error);
- if (error)
- {
- if (!warned)
- {
- g_warning ("Calling %s.IsInhibited failed: %s",
- g_dbus_proxy_get_interface_name (dbus->sm_proxy),
- error->message);
- warned = TRUE;
- }
- g_error_free (error);
- return FALSE;
- }
-
- g_variant_get (res, "(b)", &inhibited);
- g_variant_unref (res);
-
- return inhibited;
-}
-
static gboolean
gtk_application_impl_dbus_prefers_app_menu (GtkApplicationImpl *impl)
{
impl_class->set_menubar = gtk_application_impl_dbus_set_menubar;
impl_class->inhibit = gtk_application_impl_dbus_inhibit;
impl_class->uninhibit = gtk_application_impl_dbus_uninhibit;
- impl_class->is_inhibited = gtk_application_impl_dbus_is_inhibited;
impl_class->prefers_app_menu = gtk_application_impl_dbus_prefers_app_menu;
gobject_class->finalize = gtk_application_impl_dbus_finalize;
g_warning ("Invalid inhibitor cookie");
}
-static gboolean
-gtk_application_impl_quartz_is_inhibited (GtkApplicationImpl *impl,
- GtkApplicationInhibitFlags flags)
-{
- GtkApplicationImplQuartz *quartz = (GtkApplicationImplQuartz *) impl;
-
- if (flags & GTK_APPLICATION_INHIBIT_LOGOUT)
- return quartz->quit_inhibit > 0;
-
- return FALSE;
-}
-
static void
gtk_application_impl_quartz_init (GtkApplicationImplQuartz *quartz)
{
class->set_menubar = gtk_application_impl_quartz_set_menubar;
class->inhibit = gtk_application_impl_quartz_inhibit;
class->uninhibit = gtk_application_impl_quartz_uninhibit;
- class->is_inhibited = gtk_application_impl_quartz_is_inhibited;
gobject_class->finalize = gtk_application_impl_quartz_finalize;
}
gtk_application_impl_uninhibit (application->priv->impl, cookie);
}
-/**
- * gtk_application_is_inhibited:
- * @application: the #GtkApplication
- * @flags: what types of actions should be queried
- *
- * Determines if any of the actions specified in @flags are
- * currently inhibited (possibly by another application).
- *
- * Note that this information may not be available (for example
- * when the application is running in a sandbox).
- *
- * Returns: %TRUE if any of the actions specified in @flags are inhibited
- *
- * Since: 3.4
- */
-gboolean
-gtk_application_is_inhibited (GtkApplication *application,
- GtkApplicationInhibitFlags flags)
-{
- g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
- g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), FALSE);
-
- return gtk_application_impl_is_inhibited (application->priv->impl, flags);
-}
-
GtkActionMuxer *
gtk_application_get_parent_muxer_for_window (GtkWindow *window)
{
GDK_AVAILABLE_IN_3_4
void gtk_application_uninhibit (GtkApplication *application,
guint cookie);
-GDK_AVAILABLE_IN_3_4
-gboolean gtk_application_is_inhibited (GtkApplication *application,
- GtkApplicationInhibitFlags flags);
GDK_AVAILABLE_IN_3_6
GtkWindow * gtk_application_get_window_by_id (GtkApplication *application,
class->set_menubar = (gpointer) do_nothing;
class->inhibit = (gpointer) do_nothing;
class->uninhibit = (gpointer) do_nothing;
- class->is_inhibited = (gpointer) do_nothing;
class->prefers_app_menu = (gpointer) return_false;
}
GTK_APPLICATION_IMPL_GET_CLASS (impl)->uninhibit (impl, cookie);
}
-gboolean
-gtk_application_impl_is_inhibited (GtkApplicationImpl *impl,
- GtkApplicationInhibitFlags flags)
-{
- return GTK_APPLICATION_IMPL_GET_CLASS (impl)->is_inhibited (impl, flags);
-}
-
gboolean
gtk_application_impl_prefers_app_menu (GtkApplicationImpl *impl)
{